/**正常的a-form-item labelCol为8 wrapperCol为16 */
export const CFormItem = defineComponent({
  name: 'CFormItem',
  props: {
    name: {
      type: String,
      default: '',
    },
    label: {
      type: String,
      default: '',
    },
    showLabel: {
      type: Boolean,
      default: true,
    },
  },
  setup(props, {slots}) {
    return () => {
      if (props.showLabel) {
        return (
          <a-form-item label={props.label} name={props.name}>
            {slots.default?.()}
          </a-form-item>
        )
      } else {
        return (
          <a-form-item
            name={props.name}
            labelCol={{span: 0}}
            wrapperCol={{span: 24}}
          >
            {slots.default?.()}
          </a-form-item>
        )
      }
    }
  },
})

/**a-form-item labelCol为2 wrapperCol为16*/
export const MyFormItemSm = defineComponent({
  name: 'MyFormItemSm',
  props: {
    name: {
      type: String,
      default: '',
    },
    label: {
      type: String,
      default: '',
    },
  },
  setup(props, {slots}) {
    return () => (
      <a-form-item
        label={props.label}
        name={props.name}
        labelCol={{span: 2}}
        wrapperCol={{span: 16}}
      >
        {slots.default?.()}
      </a-form-item>
    )
  },
})
